/*
 * @Author: your name
 * @Date: 2021-12-02 19:57:39
 * @LastEditTime: 2021-12-14 21:39:51
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: /umi-demo/src/pages/demo/Language/index.tsx
 */
import React from 'react';
import { Button } from 'antd';
import { history } from 'umi';
const { i18next } = window;
const Language = (props: any) => {
  function changeLanguage(type: string) {
    localStorage.setItem('language', type);
    history.go(0);
  }
  debugger;
  return (
    <div>
      <h2>{window.i18next.t('多语言测试')}</h2>
      <Button onClick={() => changeLanguage('cn')}>中文</Button>
      <br />
      <Button onClick={() => changeLanguage('us')}>英文</Button>
      <br />
      {window.i18next.t('测试')}
    </div>
  );
};

export default Language;
